{include file="common/header"}
<div class="content-wrapper">
    {include file="chat/nav"/}
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="nav-tabs-custom">
                    {include file="chat/tabs"/}
                    <div class="tab-content">
                        <div class="panel panel-info">
                            <div class="panel-heading">
                                {$item['nickname']?$item['nickname']:''}&nbsp;&nbsp;{$item['create_time']?$item['create_time']:''}
                            </div>
                            <div class="panel-body">
                                {$item['content']}
                                <br>
                       {if $item['img']}
                                           <img src="{$item['img']}"  style="height:100px;width:100px">
                           {/if}
                            </div>


                        </div>

{if $list}
                         <div class="panel panel-info">
                            <div class="panel-heading">
                          管理员回复：
                            </div>
                            {volist name="list" id='d'}
                            <div class="panel-body">
                                {$d['create_time']}  :   {$d['content']}
                                <br>
                             {if $d['img']}
                                                 <img src="{$d['img']}"  style="height:100px;width:100px">
                                 {/if}
                            </div>
                    {/volist}

                        </div>

{/if}


                            <div class="panel panel-info">
                                <div class="panel-heading">
                                    反馈回复
                                </div>
                                <div class="panel-body">
<form class="form-horizontal" method="get" role="form">
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">内容</label>
                                        <div class="col-sm-6 col-xs-12">
                                            <textarea class="form-control" id="content" name="content" maxlength="1000" rows="5" placeholder="请输入反馈回复"></textarea>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">上传图片</label>
                                        <div class="col-sm-6 col-xs-12">
                                           <img src="" alt="" id="img1" style="height:100px;width:100px">
                                         <input type="file" id='upimg1'>
                                        </div>

                                      <input type="hidden" name="img" >


                                    </div>

                                    <div class="form-group">
                                        <div class="col-sm-6 col-xs-12 col-sm-offset-2">
                                            <input type="hidden" name="id" id="id" value="{$item['id']?$item['id']:0}">
                                            <button type="button" id="submit" name="submit" class="btn btn-primary">回复</button>
                                        </div>
                                    </div>

                            </div>


</form>
<form action="" id='form1'></form>

                        <link rel="stylesheet" href="/static/plugins/dialog/css/dialog.css" />
                        <script src="/static/plugins/dialog/js/dialog.js"></script>
                        <style type="text/css">
                            .dialog {
                              position: fixed;
                              left: 0;
                              top: 0;
                              z-index: 10001;
                              width: 100%;
                              height: 100%;
                            }
                            .dialog-content {
                                width: 230px;
                            }
                            .dialog-overlay {
                              position: absolute;
                              top: 0;
                              left: 0;
                              z-index: 10002;
                              width: 100%;
                              height: 100%;
                              background-color: rgba(0, 0, 0, 0.5);
                            }
                        </style>
                        <script type="text/javascript">

                          $('#upimg1').change(function(){
                            var form = new FormData(document.getElementById("form1"));
                            form.append('upimg',$('#upimg1')[0].files[0]);
                            $.post({
                              url: "/admin/feedback/upimg",
                              data:form,
                              dataType: 'json',
                              processData:false,
                              contentType: false,
                              success: function(res) {
                                  $("input[name='img']").val(res.img);
                                  $('#img1').attr('src',res.img);
                                  $('#mg1').css('display','block');
                              }
                            })
                          })




                                $("#submit").click(function () {
                                    var val=$('#content').val();
                                    var img=$("input[name='img']").val();
                                     if(val=="" && !img){
                                        $(document).dialog({
                                            titleText: '回复',
                                            content: '请输入您需要回复的内容',
                                        });
                                        return;
                                    }

                                    $.post(
                                        "{:U('save')}",
                                      	{
                                        	content:$('#content').val(),
                                            id:$('#id').val(),
                                            img:img,

                                        },
                                        function (res) {
                                            message(res.message,res.redirect,res.type)
                                        },'json'
                                    );
                                });

                        </script>
                    </div>
                    <!-- /.tab-content -->
                </div>
                <!-- /.nav-tabs-custom -->
            </div>
            <!-- /.col -->
        </div>
    </section>
</div>
{include file='common/ufooter'}
